Imports System.IO
Imports System.IO.Ports
Imports System.Threading
Public Class TestMvd

    Private testConsoleFile As APFile
    Sub New()
        testConsoleFile = New APFile("testConsole.txt")
        writeLine("test 22")
        writeLine(Now.ToString)
    End Sub
    Sub console_IsCompotOpen(ByVal SerialPort As System.IO.Ports.SerialPort, ByVal comName As String)
        Thread.Sleep(100)
        If SerialPort Is Nothing Then
            Me.writeLine(comName + " Com_Null")
        Else

            Try
                Me.writeLine(comName + " " + SerialPort.PortName + " " + "open" + " " + SerialPort.IsOpen.ToString)
            Catch ex As Exception
                Me.writeLine(comName + " Com_Error")
            End Try
        End If




    End Sub
    Sub writeLine(ByVal StringLine As String)
        Thread.Sleep(10)
        Console.WriteLine(StringLine)
        testConsoleFile.write(StringLine)
    End Sub
    Sub writeByte(ByVal StringByte As Byte(), ByVal objectName As String, ByVal e As Boolean)
        Thread.Sleep(10)
        If Not (StringByte Is Nothing) Then


            If StringByte.Length > 0 And e Then
                writeLine(objectName + " writeByte")
                testConsoleFile.write(StringByte)
            End If
        End If
    End Sub
    Sub readByte(ByVal StringByte As Byte(), ByVal objectName As String, ByVal e As Boolean)
        Thread.Sleep(10)
        If Not (StringByte Is Nothing) Then
            If StringByte.Length > 0 And e Then
                writeLine(objectName + " readByte")
                testConsoleFile.write(StringByte)
            End If
        End If
    End Sub
    Sub readByte(ByVal StringByte As String, ByVal objectName As String, ByVal e As Boolean)
        Thread.Sleep(10)
        If Not (StringByte Is Nothing) Then
            If StringByte.Length > 0 And e Then
                writeLine(objectName + " readByte")
                testConsoleFile.write(StringByte)
            End If
        End If
    End Sub
End Class
